package com.example.spmusic.media

import androidx.databinding.BaseObservable

class MusicViewModel (private val musicPlayer: MusicPlayer):BaseObservable(){
    var music: Music? = null
        set(vaule) {
            field = vaule
            notifyChange()  // 通知绑定刷新
        }

    val title: String?
        get() = music?.name

    fun onButtonClicked(){
        music?.let {
           musicPlayer.playMusic(it)
        }
    }
}